﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace AngelSpellMaker
{
    public partial class MainWaveType : Form
    {
        public MainWaveType()
        {
            InitializeComponent();
        }
        /* Tray Icon Section */
        #region Tray Icon Menu
        // Item Show Main
        private void showMainMenuToolStripMenuItem_Click(object sender, EventArgs e)
        {
            this.Show();
        }

        // Item Close Angel Spell Maker
        private void closeASMToolStripMenuItem_Click(object sender, EventArgs e)
        {
            this.Close();
        }
        // Item WebSite Angel Spell Maker
        private void updatesToolStripMenuItem_Click(object sender, EventArgs e)
        {
            System.Diagnostics.Process.Start("http://djdeath.com.ar/post/c-sharp/141/");
        }

        // Item About Angel Spell Maker
        private void aboutToolStripMenuItem_Click(object sender, EventArgs e)
        {
            AboutWin winAbout = new AboutWin();
            winAbout.Show();
        }
        #endregion
        
        // Dont Permited Open 2 ASM Proccess
        private static bool getPrevInstance()
        {
            //get the name of current process, i,e the process 
            //name of this current application

            string currPrsName = "AngelSpellMaker.exe";

            //Get the name of all processes having the 
            //same name as this process name 
            System.Diagnostics.Process[] allProcessWithThisName = System.Diagnostics.Process.GetProcessesByName(currPrsName);

            //if more than one process is running return true.
            //which means already previous instance of the application 
            //is running
            if (allProcessWithThisName.Length > 1)
            {
                MessageBox.Show("Angel Spell's Maker Already Running", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return true; // Yes Previous Instance Exist
            }
            else
            {
                return false; //No Prev Instance Running
            }
        }

        // UniWave Button //
        private void UniWaveButton_Click(object sender, EventArgs e)
        {
            UniWaveMenu uniwaveform = new UniWaveMenu();
            uniwaveform.Show();
            this.Hide();
        }
    }
}
